import QtQuick 2.7
import QtQuick.Controls 2.1
import QtMultimedia 5.5
import Demo 1.0

MusicPlayerPageForm {

    property alias source: mediaPlayer.source

    MediaPlayer {
        id: mediaPlayer
        autoPlay: true
    }

    MediaDataPicker {
        id: mediaData
        player: mediaPlayer
    }

    playInfomation.title: mediaData.title
    playInfomation.artist: mediaData.artist
    playInfomation.coverArtUrl: mediaData.coverArtUrl
    playInfomation.position: mediaPlayer.position
    playInfomation.duration: mediaPlayer.duration
    playInfomation.seekable: mediaPlayer.seekable
    playInfomation.onPlaySeek: {
        mediaPlayer.seek(pos)
    }

    playControl.isPlaying: mediaPlayer.playbackState == MediaPlayer.PlayingState
    playControl.onPlay: {
        mediaPlayer.play();
    }

    playControl.onPause: {
        mediaPlayer.pause();
    }
    playControl.onPlaylist: {

    }
    musicBrowser.onSelect: {
        mediaPlayer.source = source
    }


    Drawer {
        edge: Qt.RightEdge
        dragMargin: 20
        width: 480
        height: parent.height
        Rectangle {
            anchors.fill: parent
            color: "yellow"
        }
    }
}
